<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>
        栋数管理
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" th:href="@{/layui-v2.6.8//layui/css/layui.css}" href="${pageContext.request.contextPath }/statics/layui-v2.6.8//layui/css/layui.css">

    <link rel="stylesheet" th:href="@{/css/main.css}"  href="${pageContext.request.contextPath }/statics/css/main.css" media="all">
    <link rel="stylesheet" th:href="@{/css/bootstrap.css}"  href="${pageContext.request.contextPath }/statics/css/bootstrap.css">

</head>
<style>
    #LAY_demo1 {
        overflow: auto;
        width: 600px;
        height: 400px;
    }
</style>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>房产管理</cite></a>
              <a><cite>栋数管理</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
                                                                        style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form x-center" action="" style="width:800px">
        <div class="layui-form-pane" style="margin-top: 15px;">
            <div class="layui-form-item">
                <label class="layui-form-label">日期范围</label>
                <div class="layui-input-inline">
                    <input class="layui-input" placeholder="开始日" id="LAY_demorange_s" name="beginDate">
                </div>
                <div class="layui-input-inline">
                    <input class="layui-input" placeholder="截止日" id="LAY_demorange_e" name="overDate">
                </div>
                <div class="layui-input-inline">
                    <select name="region" id="region">
                        <option value="0">选择所属区域</option>
                        <option value="A">A区</option>
                        <option value="B">B区</option>
                        <option value="C">C区</option>
                        <option value="D">D区</option>
                        <option value="E">E区</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width:80px">
                    <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>
                    </button>
                </div>
            </div>
        </div>
    </form>
    <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll()">
            <i class="layui-icon">&#xe640;</i>批量删除
        </button>
        <button class="layui-btn" onclick="veh_add('车辆添加','parkingPlace_add','1000','600')">
            <i class="layui-icon">&#xe608;</i>添加
        </button>
        <span class="x-right" style="line-height:40px">共有数据：<span class="layui-badge" id="count">1</span> 条</span>
    </xblock>
    <table id="demo" lay-filter="test"></table>
    <div class="layui-progress" lay-showPercent="true">
        <div class="layui-progress-bar layui-bg-red" lay-percent="2/3"></div>
    </div>

    <div class="layui-progress layui-progress-big" lay-filter="demo" lay-showPercent="true">
        <div class="layui-progress-bar" lay-percent="10%"></div>
    </div>


</div>

<%--
<script src="${pageContext.request.contextPath }/statics/lib/layui/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/statics/js/x-layui.js" charset="utf-8"></script>--%>
<%--<script src="${pageContext.request.contextPath }/statics/js/x-layui.js" charset="utf-8"></script>--%>
<script th:src="@{/layui-v2.6.8/layui/layui.js}" src="${pageContext.request.contextPath }/statics/layui-v2.6.8/layui/layui.js"></script>
<script>
    layui.use('table', function () {
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#demo'
            , height: 312
            , url: 'list?size=40&current=1' //数据接口
            , page: true //开启分页
            , cols: [[ //表头
                {field: 'id', title: 'ID', width: 80, sort: true, fixed: 'left'}
                , {field: 'region', title: '所属区域', width: 80}
                , {field: 'dong_no', title: '栋数编号', width: 80, sort: true}
                , {field: 'sum', title: '总户数', width: 80}
                , {field: 'remark', title: '描述', width: 177}
                , {field: 'create_date', title: '创建时间', width: 80, sort: true}
                // , {field: 'score', title: '操作', width: 80, sort: true}
            ]], parseData: function (res) {
                console.log('返回的值', res)
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "data": res.data.records //解析数据列表
                };
            }, request: {
                pageName: 'curr' //页码的参数名称，默认：page
                , limitName: 'nums' //每页数据量的参数名，默认：limit
            }
        });

    });
</script>

<script>
    layui.use('flow', function () {
        var flow = layui.flow;

        flow.load({
            elem: '#LAY_demo1' //流加载容器
            , scrollElem: '#LAY_demo1' //滚动条所在元素，一般不用填，此处只是演示需要。
            , done: function (page, next) { //执行下一页的回调

                //模拟数据插入
                setTimeout(function () {
                    var lis = [];

                    for (var i = 0; i < 80; i++) {
                        if (obj != null) {
                            lis.push('<li style="border: 1px red solid;width: 100px;height: 100px;float: left">' + ((page - 1) * 8 + i + 1) + '</li>')
                        } else {
                            lis.push('<li style="border: 1px green solid;width: 100px;height: 100px;float: left">' + ((page - 1) * 8 + i + 1) + '</li>')
                        }
                    }

                    //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
                    //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                    next(lis.join(''), page < 10); //假设总页数为 10
                }, 500);
            }
        });

    });
</script>
<%--<script>
    var totaPageCount;
    var roomlist = function showinfo(curr, region, beginDate, overDate) {
        $.ajax({
            url: "list",
            data: {size: 4, current: curr, region: region, beginDate: beginDate, overDate: overDate},
            type: "GET",
            async: false,//取消异步请求
            dataType: "json",
            success: function (data) {
                console.log(data)
                totaPageCount = data.data.pages
                $("#ches").html("");
                $(data.data.records).each(function () {
                    var sta = "<td class=\"td-manage\"><a title=\"编辑\" href=\"javascript:;\" onclick=\"home_edit('编辑','homeadd.html'," + this.id + ",'1000','600')\"\n" +
                        "class=\"ml-5\" style=\"text-decoration:none\"><i class=\"layui-icon\">&#xe642;</i></a>\n" +
                        "<a title=\"删除\" href=\"javascript:;\" onclick=\"building_del(this," + this.id + ")\"style=\"text-decoration:none\"><i class=\"layui-icon\">&#xe640;\n" +
                        "</i></a></td>"

                    var str = "<tr><td><input type=\"checkbox\" value=" + this.id + " name='active' id=\"che\"></td>" +
                        "<td>" + this.id + "</td><td>" + this.region + "</td>" +
                        "<td>" + this.dongNo + "</td>" +
                        "<td>" + this.sum + "</td><td>" + this.remark + "</td>" +
                        "<td>" + this.createDate + "</td>" + sta + "</tr>"
                    $("#ches").append(str);
                })
                $(".layui-badge").text(data.data.total);
            }
        })
    }
    roomlist(1, null, null, null)

    layui.use(['laydate', 'element', 'laypage', 'layer', 'form'], function () {
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        form = layui.form();
        okLoading.close($);
        //以上模块根据需要引入

        form.on('submit(sreach)',
            function (data) {
                var region = data.field.region
                var beginDate = data.field.beginDate
                var overDate = data.field.overDate
                roomlist(1, region, beginDate, overDate);
                page(totaPageCount, region, beginDate, overDate)
                return false
            })

        function page(totaPageCount, region, beginDate, overDate) {
            laypage({
                cont: 'page'
                , pages: totaPageCount
                , first: 1
                , last: totaPageCount
                , prev: '<em><</em>'
                , next: '<em>></em>'
                , jump: function (obj, first) {
                    curr = obj.curr;//得到点击的页数
                    if (!first) {
                        roomlist(curr, region, beginDate, overDate)
                    }

                }
            });
        }

        page(totaPageCount)

        var start = {
            max: '2099-06-16 23:59:59'
            , choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: laydate.now()
            , max: '2099-06-16 23:59:59'
            , choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function () {
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function () {
            end.elem = this
            laydate(end);
        }
    });

    //批量删除提交
    function delAll() {
        layer.confirm('确认要删除吗？', function (index) {
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
        });
    }

    /*添加*/
    function building_add(title, url, w, h) {
        x_admin_show(title, url, w, h);
    }

    //编辑
    function building_edit(title, url, id, w, h) {
        url = url + "?id=" + id;
        x_admin_show(title, url, w, h);
    }

    /*删除*/
    function building_del(obj, id) {
        layer.confirm('确认要删除吗？', {icon: 3, title: '提示信息'}, function (index) {
            $.ajax({
                type: "delete",
                url: "delete",
                data: {idList: id},
                dataType: "json",
                success: function (data) {
                    if (data.data == true) {
                        //发异步删除数据
                        $(obj).parents("tr").remove();
                        layer.msg(data.msg, {icon: 6, time: 1000});
                        setTimeout(function () {
                            window.location.reload();
                        }, 1000);
                        return false;
                    } else {
                        layer.msg("删除失败", {icon: 5, time: 1000});
                        return false;
                    }
                }
            });
            //发异步删除数据
            $(obj).parents("tr").remove();
            layer.msg('已删除!', {icon: 1, time: 1000});
        });
    }
</script>--%>
</body>
</html>